# include <iostream>
# include <vector>

using namespace std;

// 非引用形参
void print(vector<double> v)
{
     cout << "非引用传参\n";
    vector<double>::iterator begin = v.begin();
    while (begin != v.end())
    {
        cout << *begin << endl;
        begin++;
    }
    
}

// 引用形参,更快
void print1(vector<double> &v)
{
    cout << "引用传参\n";
    vector<double>::iterator begin = v.begin();
    while (begin != v.end())
    {
        cout << *begin << endl;
        begin++;
    }
    
}

// 
void print1(
    vector<double>::const_iterator beg,
    vector<double>::const_iterator end
)
{
    cout << "迭代器传参\n";
    while (beg != end)
    {
        cout << *beg << endl;
        beg++;
    }
    
}

int main()
{
    vector<double> dvec;
    dvec.push_back(0.1);
    dvec.push_back(0.2);
    dvec.push_back(1.2);
    print(dvec);
    cout << "==========================" << endl;
    print1(dvec);
    cout << "==========================" << endl;
    print1(dvec.begin(), dvec.end());
    return 0;
}